#ifdef __cplusplus
	#include <cstdlib>
#else
	#include <stdlib.h>
#endif
#ifdef __APPLE__
	#include <SDL/SDL.h>
#else
	#include <SDL.h>
#endif

#include "Types.h"

int main (int32_t argc, char** argv) {
	if (SDL_Init( SDL_INIT_VIDEO ) < 0) {
		printf( "Unable to init SDL: %s\n", SDL_GetError() );
		return 1;
	}

	atexit(SDL_Quit);

	SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE|SDL_DOUBLEBUF);
	if (!screen) {
		printf("Unable to set 640x480 video: %s\n", SDL_GetError());
		return 1;
	}


	bool done = false;
	while (!done) {
		SDL_Event event;
		while (SDL_PollEvent(&event)) {
			switch (event.type) {
			case SDL_QUIT:
				done = true;
				break;
			case SDL_KEYDOWN: {
					if (event.key.keysym.sym == SDLK_ESCAPE)
						done = true;
					break;
				}
			}
		}
		SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 0, 0));

		SDL_Flip(screen);
	}
	return 0;
}
